package com.cv.infra.controller.system.dynamicThreadPool;

import com.cv.framework.common.pojo.Result;
import com.cv.infra.controller.system.dynamicThreadPool.vo.DynamicThreadPoolReqVO;
import com.cv.infra.controller.system.dynamicThreadPool.vo.DynamicThreadPoolRespVO;
import com.cv.infra.service.dynamicThreadPool.DynamicThreadPoolService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

import static com.cv.framework.common.pojo.Result.success;

/**
 * 基础设施 - 动态线程池控制层
 *
 * @author Charles_XDXD
 */
@Tag(name = "基础设施 - 动态线程池控制层")
@RestController
@RequestMapping("/infra/dynamic-thread-pool")
public class DynamicThreadPoolController {

    @Resource
    private DynamicThreadPoolService dynamicThreadPoolService;

    @GetMapping("info")
    @Operation(summary = "获得动态线程池基本配置信息")
    public Result<DynamicThreadPoolRespVO> getDynamicThreadPoolInfo() {
        return success(dynamicThreadPoolService.getDynamicThreadPoolInfo());
    }

    @PutMapping("modify")
    @Operation(summary = "修改动态线程池基本配置信息")
    public Result<Void> modifyDynamicThreadPool(@RequestBody DynamicThreadPoolReqVO dynamicThreadPoolReqVO) {
        dynamicThreadPoolService.modifyDynamicThreadPool(dynamicThreadPoolReqVO);
        return success();
    }

}
